import {login,addClasses,exist,getClasses,delClasses,getClass,editClasses,} from "../../api/classes";

export default {
    namespaced: true,
    state: {
        classes: {},
    },
    mutations: {
        SET_CLASSES(state, data) {
            state.classes = data;
        },
    },
    actions: {
        //问卷管理 获取班级信息
        getClassesAll() {
            return getClasses({ perPage: 999 })
        },

        login(store, data) {
            return login(data);
        },
        //获取数据
        async getClasses({ commit }, params) {
            const { data } = await getClasses(params);
            commit("SET_CLASSES", data);
        },
        addClasses(store, data) {
            return addClasses(data);
        },
        exist(store, params) {
            return exist(params);
        },
        delClasses(store, id) {
            return delClasses(id);
        },
        getClass(store, id) {
            return getClass(id);
        },
        editClasses(store, { id, data }) {
            return editClasses(id, data);
        },
    },
};
